<template>
  <div>
    <!--引用表格-->
   <BasicTable @register="registerTable">
     <!--插槽:table标题-->
      <template #tableTitle>
          <!--
          <j-upload-button  type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>-->
          
      </template>

      
      <template #resultSlot="{ record }">
        <Tag v-if="record.result=='0'" color="red">未处理</Tag>
        <Tag v-if="record.result=='1'" color="green">已处理</Tag>
      </template>

      <template #alarmTypeSlot="{ record }">
        <Tag v-if="record.alarmType=='1'" color="green">低电量</Tag>
        <Tag v-if="record.alarmType=='2'" color="red">关机提醒</Tag>
        <Tag v-if="record.alarmType=='3'" color="red">SOS报警</Tag>
        <Tag v-if="record.alarmType=='8'" color="red">体温正常提醒</Tag>
        <Tag v-if="record.alarmType=='9'" color="red">体温异常报警</Tag>
        <Tag v-if="record.alarmType=='10'" color="red">自动关机</Tag>
        <Tag v-if="record.alarmType=='11'" color="red">开机提醒</Tag>
        <Tag v-if="record.alarmType=='14'" color="red">进围栏报警(学校)</Tag>
        <Tag v-if="record.alarmType=='16'" color="red">出围栏报警(学校)</Tag>
        <Tag v-if="record.alarmType=='18'" color="red">双向围栏报警(学校)</Tag>
        <Tag v-if="record.alarmType=='20'" color="red">进围栏报警(家长)</Tag>
        <Tag v-if="record.alarmType=='22'" color="red">出围栏报警(家长)</Tag>
        <Tag v-if="record.alarmType=='24'" color="red">双向围栏报警(家长)</Tag>
        <Tag v-if="record.alarmType=='26'" color="red">到家提醒</Tag>
        <Tag v-if="record.alarmType=='27'" color="red">离家提醒</Tag>
        <Tag v-if="record.alarmType=='28'" color="red">进校提醒</Tag>
        <Tag v-if="record.alarmType=='29'" color="red">离校提醒</Tag>
        <Tag v-if="record.alarmType=='30'" color="red">进危险区域报警</Tag>
        <Tag v-if="record.alarmType=='31'" color="red">设备充电</Tag>
        <Tag v-if="record.alarmType=='32'" color="red">进入越界报警</Tag>
        <Tag v-if="record.alarmType=='33'" color="red">离开越界报警</Tag>
      </template>
    </BasicTable>
   
  </div>
</template>

<script lang="ts" name="esidcard-alarm" setup>
  import {reactive} from 'vue';
  import {BasicTable} from '/@/components/Table';
  import { Tag} from 'ant-design-vue';
  import { useListPage } from '/@/hooks/system/useListPage'
  import {columns, searchFormSchema} from './Alarm.data';
  import {list} from './Alarm.api';
  const queryParam = reactive<any>({});
  //注册model

  //注册table数据
  const { tableContext } = useListPage({
      tableProps:{
           title: '报警信息',
           api: list,
           columns,
           canResize:false,
           showActionColumn:false,
            clickToRowSelect:true,
            rowSelection:{type:'radio'},
           formConfig: {
              //labelWidth: 120,
              schemas: searchFormSchema,
              autoSubmitOnEnter:true,
              fieldMapToNumber: [
              ],
              fieldMapToTime: [
                 ['accessDate', ['startTime', 'endTime'], 'YYYY-MM-DD'],
              ],
            },
           actionColumn: {
               width: 120,
               fixed:'right'
            },
            beforeFetch: (params) => {
              return Object.assign(params, queryParam);
            },
      }
  })

  const [registerTable] = tableContext
 

   

</script>

<style scoped>

</style>